package com.example.demo.mapper;

import com.example.demo.model.UserModel;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * Create by keboom on 2020/7/4
 */
@Mapper
public interface UserMapper {

    @Select("select userId,userName,userBalance,userBirthday,userSex from user")
    List<UserModel> selectAll();

    @Select("select userName,userBalance,userBirthday,userSex from user where userId=#{id}")
    UserModel selectById(Integer id);

    @Update("update user set userName=#{userName},userBirthday=#{userBirthday},userSex=#{userSex},userBalance=#{userBalance} where userId=#{userId}")
    int updateById(UserModel userModel);

    @Delete("delete from user where userId=#{id}")
    int deleteById(Integer id);
}
